1. Field of the Invention
The present invention relates to computer systems and software. More specifically, the present invention relates to a method and an apparatus for determining the dependent classes of objects and/or classes.
2. Related Art
The advent of object-oriented programming and just-in-time compilers has brought about many changes in the way in which applications are written and distributed. Traditionally, applications are compiled for specific operating systems, and a copy must be distributed for every platform on which the application will run. With modern platform-independent languages, instead of compiling the source code, the source code is distributed and is compiled on the end machine at the time of use. This practice has many advantages with the biggest being true platform independence. Write your application once and it can be run on virtually any machine.
Object-oriented programming further revolutionized the software industry by organizing code into classes and objects, which reduced distribution sizes and further promoted reusing code. One programmer can borrow a class or an object from another programmer to add functionality to an application. Upon distribution of an application, all of the classes referenced by that application must be distributed with the application if the client system does not already contain a copy of the classes. In addition, classes can contain references to other classes which must also be included for the application to work properly.
As a direct result of this type of programming, several major problems have been created. First, in order to support application delivery over the Internet, programmers are looking to compact the size of their distribution files to reduce download times, and in turn, heighten customer satisfaction. Many programmers accomplish this by running the application on a machine with just the core classes installed and adding the necessary classes as the application reports that these classes are not found. This is very time consuming, and is not all-inclusive. If a certain part of the application is not invoked, or the system contained more than just the core classes, it is possible that some critical classes might be missed. Some programmers simply add all of the class files that are on their machine. This leads to extremely large and unnecessary distributions.
This problem is further compounded by the fact that classes can contain references to other classes, which in turn can contain references to yet more classes, and so forth. Even if you were to document every class that is directly referenced by an application as it was being developed, you would almost certainly be missing classes critical for the execution of the application. Because of their referential nature, it becomes extremely difficult to create a list of all the classes necessary, but only the classes necessary, for an application to execute.
Simple object databases can be constructed by serializing the database objects into an indexed data file. These objects can be reconstituted by deserializing that data only if all of the supporting classes for that data are accessible. Such a database that is shared between multiple applications (a system-wide object registry, for example) can be corrupted by a client application that inserts a new object into the shared database that references a class that is not commonly available. When the object is deserialized within an application that does not have access to the classes required to reconstitute that object, a ClassNotFound type of exception or error is generated.
What is needed is a method and an apparatus for efficiently determining the dependent classes of an object and/or a class.